#include "mainscene.h"
#include "ui_mainscene.h"

MainScene::MainScene(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::MainScene)
{
    ui->setupUi(this);
    //初始化场景
    initSence();

    //开始按钮的大小
    ui->Start_Btn->setFixedSize(200,70);
    //开始按钮的位置
    ui->Start_Btn->move((GAME_WIDTH-ui->Start_Btn->width())*0.5,(GAME_HEIGHT-ui->Start_Btn->height())*0.5+300);
    //选择按钮的位置
    ui->Select_Btn->move((GAME_WIDTH-ui->Start_Btn->width())*0.5-20,(GAME_HEIGHT-ui->Start_Btn->height())*0.5+400);

    //商店按钮
    ui->shop_btn->move(700,250);
    //透明化商店按钮
    ui->shop_btn->setFlat(true);
    ui->shop_btn->setAttribute(Qt::WA_TranslucentBackground);
}

void MainScene::initSence()
{

    //设置窗口固定尺寸
    setFixedSize(GAME_WIDTH,GAME_HEIGHT);
    //设置标题
    setWindowTitle(GAME_TITLE);
    //设置标题图片
    setWindowIcon(QIcon(":/rec.image/Icon.png"));
}

void MainScene::paintEvent(QPaintEvent *event)
{
    QPixmap pix;
    pix.load(":/rec.image/Mainscene_Back01.png");
    QPainter painter(this);
    painter.drawPixmap(0,0,pix);
}

MainScene::~MainScene()
{
    delete ui;


}

